/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.DimensionDao;
import com.taobao.snowsnow.hibernate.pojo.Dimension;
import com.taobao.snowsnow.hibernate.service.DimensionService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class DimensionServiceImpl extends BaseServiceImpl implements DimensionService {
	private DimensionDao ddao;
	
	public List<Dimension> findAll() {
		try {
			return ddao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public Dimension findById(int id) {
		try {
			return ddao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
		}
		return null;
	}
	
	public List<Dimension> findByName(String name) {
		try {
			return ddao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
		}
		return null;
	}

	public long getTotal()  {
		try {
			return ddao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
		}
		return -1;
	}

	public List<Dimension> paging(int page, int limit)  {
		try {
			return ddao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
		}
		return null;
	}

	public void setDdao(DimensionDao cdao) {
		this.ddao = cdao;
	}

	public DimensionDao getDdao() {
		return ddao;
	}

	@Override
	public Dimension getFirstObject() {
		try {
			return ddao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Dimension getFirstObject()");
		}
		return null;
	}

	@Override
	public Dimension getLastObject() {
		try {
			return ddao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("Dimension getLastObject()");
		}
		return null;
	}

	@Override
	public Dimension findByNamePrecise(String name) {
		try {
			return ddao.findByNamePrecise(name);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Dimension findByNamePrecise()");
		}
		return null;
	}
}
